Skip to content

Add enum picker editing for schema params#305

Open
eviltester wants to merge 7 commits into
masterfrom
295-enum-picker
Open

Add enum picker editing for schema params#305
eviltester wants to merge 7 commits into
masterfrom
295-enum-picker

Conversation

@eviltester

@eviltester eviltester commented Jul 2, 2026

Copy link
Copy Markdown
Owner

Summary

  • render schema params with explicit enum metadata as dropdown pickers in the params editor
  • refactor domain command params to use type: "enum" with enumValues arrays, including canonical plural timestamp units
  • preserve enum metadata through domain/faker help normalization and validation
  • add Jest, Storybook, shared schema controller, and browser/page-object coverage for enum picker editing

Validation

  • pnpm run verify:ui
  • pnpm run test:browser
  • pnpm run test:storybook
  • pnpm run build-storybook
  • pnpm run verify:local
  • pre-commit hook: pnpm run format:check and pnpm run testverbose
  • pre-push hook: pnpm run verify:local

Summary by CodeRabbit

  • New Features

    • Enhanced the params editor with enum-aware selection (dropdown-based), including correct required/optional/unset behavior and reliable serialization back to schema text.
    • Extended enumerated-constraint metadata so more keyword arguments are presented/validated as explicit enums in editor flows.
  • Bug Fixes

    • Improved schema editor apply/sync behavior and strengthened enum parsing/preview gating, including clearer empty-enum error handling.
    • Refined dialog focus and input change handling for smoother keyboard/UX behavior.
  • Documentation

    • Updated faker param comparison review notes.
  • Tests

    • Added Storybook and Playwright end-to-end coverage for enum dialogs, plus expanded unit tests around enum parsing and serialization.

Copilot AI review requested due to automatic review settings July 2, 2026 19:08
@coderabbitai

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@eviltester, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 41 seconds

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 3f28aa08-f07c-405a-a122-46ab7e808040

📥 Commits

Reviewing files that changed from the base of the PR and between 4601c14 and 37afbcb.

📒 Files selected for processing (5)
  • packages/core-ui/js/gui_components/shared/test-data/schema/shared-schema-editor-controller.js
  • packages/core-ui/js/gui_components/shared/test-data/ui/params-editor-modal.css
  • packages/core-ui/js/gui_components/shared/test-data/ui/params-editor-modal.js
  • packages/core-ui/src/tests/shared/shared-schema-editor-controller.test.js
  • packages/core-ui/src/tests/utils/params-editor-modal.test.js
📝 Walkthrough

Walkthrough

This PR adds enum-specific parameter editing, propagates enum metadata through help and validation layers, and updates keyword definitions and tests to use explicit enum schemas and enum-aware empty-value handling.

Changes

Enum params support

Layer / File(s) Summary
Params editor modal enum rendering and parsing
packages/core-ui/js/gui_components/shared/test-data/ui/params-editor-modal.js, packages/core-ui/js/gui_components/shared/test-data/ui/params-editor-modal.css, packages/core-ui/js/gui_components/shared/test-data/help/help-model-builder.js, packages/core-ui/src/tests/utils/params-editor-modal.test.js
Adds enum choice resolution, select-based rendering, read-back/synchronization updates, styling, and modal unit coverage.
Domain keyword enum validation and catalog normalization
packages/core/js/domain/domain-keywords.js, packages/core/js/faker/faker-helper-keyword-definitions.js, packages/core-ui/src/tests/shared/help-model-builder.test.js, packages/core-ui/src/tests/utils/faker-command-help-metadata.test.js, docs/domain-faker-param-comparison.md, packages/core/src/tests/data_generation/unit/domain/domain-keyword-params-usage.test.js, packages/core/src/tests/data_generation/unit/domain/domainKeywords.test.js
Propagates enum metadata through normalized help shapes and updates spec-aware type matching, sample generation, and related assertions.
Keyword definitions switched to enum type/enumValues
packages/core/js/keywords/domain/**/*-keyword-definition.js, packages/core/src/tests/data_generation/**/*
Converts constrained keyword arguments across multiple domains to explicit enum schemas and updates validation/error-message tests.
Params dialog UI wiring, controller test, and browser/story coverage
apps/web/src/tests/browser/shared/abstractions/components/*, apps/web/src/tests/browser/generator/functional/schema-edit.spec.js, apps/web/src/stories/shared-schema-definition.stories.js, packages/core-ui/src/tests/shared/shared-schema-editor-controller.test.js
Adds enum selection helpers and end-to-end coverage for editing enum params through the dialog.

Estimated code review effort: 4 (Complex) | ~45 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding enum picker editing for schema params.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 295-enum-picker

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds first-class enum parameter metadata and editing support across the domain keyword catalog and the schema params editor, so commands that define explicit enum choices render as dropdown pickers (with correct serialization/validation and end-to-end test coverage).

Changes:

  • Refactors many domain keyword param schemas to use type: "enum" + enumValues instead of pipe-delimited unions.
  • Updates domain/faker help normalization + keyword arg validation to preserve and validate enum metadata.
  • Enhances the params editor modal UI to render enum params as <select> controls (including unset + empty-string handling) and adds Jest/Storybook/Playwright coverage.

Reviewed changes

Copilot reviewed 50 out of 50 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/core/src/tests/data_generation/unit/domain/domainKeywords.test.js Updates test arg sampling to respect enumValues.
packages/core/src/tests/data_generation/unit/domain/domain-keyword-params-usage.test.js Updates keyword param sampling/execution tests for enum specs.
packages/core/src/tests/data_generation/keywords/domain/autoincrement/timestamp-exec.test.js Updates expected validation error output for enum timestamp units.
packages/core/js/keywords/domain/word/verb-keyword-definition.js Converts strategy to explicit enum metadata.
packages/core/js/keywords/domain/word/sample-keyword-definition.js Converts strategy to explicit enum metadata.
packages/core/js/keywords/domain/word/preposition-keyword-definition.js Converts strategy to explicit enum metadata.
packages/core/js/keywords/domain/word/noun-keyword-definition.js Converts strategy to explicit enum metadata.
packages/core/js/keywords/domain/word/interjection-keyword-definition.js Converts strategy to explicit enum metadata.
packages/core/js/keywords/domain/word/conjunction-keyword-definition.js Converts strategy to explicit enum metadata.
packages/core/js/keywords/domain/word/adverb-keyword-definition.js Converts strategy to explicit enum metadata.
packages/core/js/keywords/domain/word/adjective-keyword-definition.js Converts strategy to explicit enum metadata.
packages/core/js/keywords/domain/string/uuid-keyword-definition.js Converts UUID version param to enum metadata.
packages/core/js/keywords/domain/string/hexadecimal-keyword-definition.js Converts casing param to enum metadata.
packages/core/js/keywords/domain/string/alphanumeric-keyword-definition.js Converts casing param to enum metadata.
packages/core/js/keywords/domain/string/alpha-keyword-definition.js Converts casing param to enum metadata.
packages/core/js/keywords/domain/phone/number-keyword-definition.js Converts phone style param to enum metadata.
packages/core/js/keywords/domain/person/prefix-keyword-definition.js Converts sex param to enum metadata.
packages/core/js/keywords/domain/person/middle-name-keyword-definition.js Converts sex param to enum metadata.
packages/core/js/keywords/domain/person/last-name-keyword-definition.js Converts sex param to enum metadata.
packages/core/js/keywords/domain/person/first-name-keyword-definition.js Converts sex param to enum metadata.
packages/core/js/keywords/domain/lorem/word-keyword-definition.js Converts strategy param to enum metadata.
packages/core/js/keywords/domain/location/country-code-keyword-definition.js Converts variant param to enum metadata.
packages/core/js/keywords/domain/internet/url-keyword-definition.js Converts protocol param to enum metadata.
packages/core/js/keywords/domain/internet/mac-keyword-definition.js Converts separator param to enum metadata (incl empty string choice).
packages/core/js/keywords/domain/internet/ipv4-keyword-definition.js Converts network param to enum metadata with explicit array choices.
packages/core/js/keywords/domain/finance/bitcoin-address-keyword-definition.js Converts type/network params to enum metadata.
packages/core/js/keywords/domain/date/birthdate-keyword-definition.js Converts mode param to enum metadata.
packages/core/js/keywords/domain/commerce/isbn-keyword-definition.js Converts variant param to enum metadata.
packages/core/js/keywords/domain/color/rgb-keyword-definition.js Converts casing/format params to enum metadata.
packages/core/js/keywords/domain/color/lch-keyword-definition.js Converts format param to enum metadata.
packages/core/js/keywords/domain/color/lab-keyword-definition.js Converts format param to enum metadata.
packages/core/js/keywords/domain/color/hwb-keyword-definition.js Converts format param to enum metadata.
packages/core/js/keywords/domain/color/hsl-keyword-definition.js Converts format param to enum metadata.
packages/core/js/keywords/domain/color/color-by-csscolor-space-keyword-definition.js Converts format/space params to enum metadata.
packages/core/js/keywords/domain/color/cmyk-keyword-definition.js Converts format param to enum metadata.
packages/core/js/keywords/domain/autoincrement/timestamp-keyword-definition.js Defines canonical plural timestamp units and exposes them as enum choices.
packages/core/js/keywords/domain/airline/seat-keyword-definition.js Converts aircraftType param to enum metadata.
packages/core/js/faker/faker-helper-keyword-definitions.js Preserves enum/choice metadata through faker helper help normalization/mapping.
packages/core/js/domain/domain-keywords.js Adds enum-aware type tokenization/validation + preserves allowed/choice metadata on args.
packages/core-ui/src/tests/utils/params-editor-modal.test.js Adds unit tests for enum-choice resolution, parsing, rendering, and serialization.
packages/core-ui/src/tests/utils/faker-command-help-metadata.test.js Updates expectations for enum-typed params in generated help metadata.
packages/core-ui/src/tests/shared/shared-schema-editor-controller.test.js Adds controller-level test for applying enum picker params back into schema rows.
packages/core-ui/src/tests/shared/help-model-builder.test.js Verifies enum metadata appears in schema help models (timestamp units).
packages/core-ui/js/gui_components/shared/test-data/ui/params-editor-modal.js Implements enum choice inference/resolution + enum <select> editor + serialization rules.
packages/core-ui/js/gui_components/shared/test-data/ui/params-editor-modal.css Styles enum selects consistently with other inputs and adds focus-visible handling.
packages/core-ui/js/gui_components/shared/test-data/help/help-model-builder.js Normalizes enum/choice arrays into help param models.
apps/web/src/tests/browser/shared/abstractions/components/schema-editor.component.js Updates schema editor abstraction focus behavior and adds helper to edit enum params via dialog.
apps/web/src/tests/browser/shared/abstractions/components/params-editor-dialog.component.js Adds Playwright abstraction for enum selects in the params editor dialog.
apps/web/src/tests/browser/generator/functional/schema-edit.spec.js Adds Playwright functional coverage for selecting enum params via guided dialog.
apps/web/src/stories/shared-schema-definition.stories.js Adds Storybook story demonstrating enum dropdown param editing flow.

Comment thread packages/core/js/domain/domain-keywords.js

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1d9568f40b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/core-ui/js/gui_components/shared/test-data/ui/params-editor-modal.js Outdated
@greptile-apps

greptile-apps Bot commented Jul 2, 2026

Copy link
Copy Markdown

Greptile Summary

This PR introduces enum-picker editing for schema params — params with explicit enumValues (or allowedValues/choices) arrays now render as <select> dropdowns instead of text inputs in the params editor dialog. The keyword definitions across ~30 domain commands are migrated from pipe-delimited type strings ('a|b|c') to structured { type: 'enum', enumValues: [...] } objects, and empty string is now a valid enum member throughout the parsing, validation, and serialization stack.

  • UI layer (params-editor-modal.js): New resolveEnumChoices / normalizeParamMetadata helpers compute enumChoices and an isSet flag for each param entry; renderEnumValueEditor renders a <select> using a sentinel ENUM_EMPTY_VALUE to distinguish a selected empty-string option from the unset placeholder; readRenderedEntryState reads data-enum-value to recover the real value (including ''); formatEditorValue serializes numeric enum tokens without quotes and string tokens with JSON.stringify.
  • Core validation (domain-keywords.js, enumParser.js): isTypeMatch / formatExpectedType / describeMismatchedArgValue are refactored to accept a full spec object and dispatch on type === 'enum' + enumValues; EnumTestDataRuleValidator drops the blanket empty-value rejection; parseCsvLiteralFields is extracted from parseCsvLiteral so callers can distinguish quoted from unquoted empty fields.
  • Propagation: buildDomainKeywordCatalog, normalizeFakerHelperKeywordHelp, mapDomainKeywordHelpToFakerCommandHelp, and normalizeHelpParam are all updated to copy allowedValues/choices/enumValues through so metadata reaches the UI.

Confidence Score: 5/5

Safe to merge — changes are well-tested across unit, Storybook, and browser layers with no regressions found in the core data generation or UI paths.

The enum picker, empty-string support, and type-validation refactor all follow through correctly end-to-end: resolveEnumChoices precedence is well-defined and tested, the isSet/ENUM_EMPTY_VALUE sentinel approach cleanly handles the empty-string selection edge case, formatEditorValue correctly keeps numeric enum tokens unquoted, and the domain-keywords isTypeMatch/formatExpectedType refactor aligns with the new spec object shape. The previously flagged focus ordering bug is fixed. All ~30 keyword definitions are consistently migrated. The breadth of new tests covers the critical paths.

No files require special attention.

Important Files Changed

Filename Overview
packages/core-ui/js/gui_components/shared/test-data/ui/params-editor-modal.js Core enum picker UI logic: adds resolveEnumChoices, normalizeParamMetadata, renderEnumValueEditor, and refactors readRenderedEntryState to return isSet; focus fix (editorInputs DOM-order query) addresses the previously-flagged issue.
packages/core/js/data_generation/utils/enumParser.js Extracts parseCsvLiteralFields from parseCsvLiteral to track quoted/unquoted status; allows quoted empty strings in parseCsvEnumValues while still rejecting unquoted empty fields; adds allowEmptyStrings option to validateEnumValueList.
packages/core/js/domain/domain-keywords.js Refactors isTypeMatch / formatExpectedType / describeMismatchedArgValue to accept a full spec object and dispatch on type=enum+enumValues; normalizeLiteralTypeToken now handles empty-string and punctuation-only tokens via JSON.stringify; buildDomainKeywordCatalog now copies allowedValues/choices/enumValues.
packages/core/js/data_generation/enum/enumTestDataRuleValidator.js Removes the blanket check that rejected empty string enum values; validation still rejects unquoted empty fields via EnumParser, and single-value explicit enum is allowed by the existing minimumValues logic.
packages/core/js/keywords/domain/internet/mac-keyword-definition.js Changes separator type from pipe-delimited string to type=enum with enumValues including empty string; enables dropdown UI and correct isTypeMatch for the empty separator case.
packages/core/js/keywords/domain/autoincrement/timestamp-keyword-definition.js Converts type parameter from generic string to type=enum with canonical plural time-unit values; changes error message from custom validator text to the standard domain-keywords mismatch format.
packages/core-ui/js/gui_components/shared/schema-row-rule-mapper.js Wraps EnumParser.buildSchemaRuleSpecFromInput in a try/catch fallback (buildEditableEnumRuleSpec) so invalid enum params no longer throw during schema row serialization.
packages/core-ui/js/gui_components/shared/test-data/schema/shared-schema-editor-controller.js Adds focusParamsButtonForRow helper and calls it after the params editor closes so focus returns to the triggering button.
packages/core/js/keywords/domain/datatype/datatype-enum.js normalizeDatatypeEnumValuesFromArgs now delegates to validateEnumValueList with allowEmptyStrings=true and uses parseCsvEnumValues for comma-containing strings instead of the old extractEnumValues path.
packages/core-ui/src/tests/utils/params-editor-modal.test.js Adds 439 lines of new tests: enum dropdown rendering, required/optional/unset behavior, empty string option, numeric enum serialization, string-union auto-quoting, and focus ordering; comprehensive coverage for all new code paths.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Keyword Definition type=enum enumValues array] --> B[buildDomainKeywordCatalog copies enumValues into spec]
    B --> C[normalizeHelpParam preserves enumValues]
    C --> D[openParamsEditorModal receives helpModel params]
    D --> E[normalizeParamMetadata resolveEnumChoices builds enumChoices]
    E --> F{enumChoices length gt 0?}
    F -- Yes --> G[renderEnumValueEditor select with sentinel values]
    F -- No --> H[renderValueEditor text or boolean input]
    G --> I[readRenderedEntryState data-enum-value attr plus isSet flag]
    H --> I
    I --> J[buildParamsTextFromEditorEntries hasEntryValue checks isSet OR trimmed value]
    J --> K[formatEditorValue numeric enum raw / string enum quoted]
    K --> L[Schema text output]
    M[validateSingleKeywordArg] --> N{spec type is enum?}
    N -- Yes --> O[isTypeMatch checks against enumValues elements]
    N -- No --> P[isTypeMatch checks pipe-delimited type tokens]
    O --> Q[formatExpectedType renders empty string as double-quoted]
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
    A[Keyword Definition type=enum enumValues array] --> B[buildDomainKeywordCatalog copies enumValues into spec]
    B --> C[normalizeHelpParam preserves enumValues]
    C --> D[openParamsEditorModal receives helpModel params]
    D --> E[normalizeParamMetadata resolveEnumChoices builds enumChoices]
    E --> F{enumChoices length gt 0?}
    F -- Yes --> G[renderEnumValueEditor select with sentinel values]
    F -- No --> H[renderValueEditor text or boolean input]
    G --> I[readRenderedEntryState data-enum-value attr plus isSet flag]
    H --> I
    I --> J[buildParamsTextFromEditorEntries hasEntryValue checks isSet OR trimmed value]
    J --> K[formatEditorValue numeric enum raw / string enum quoted]
    K --> L[Schema text output]
    M[validateSingleKeywordArg] --> N{spec type is enum?}
    N -- Yes --> O[isTypeMatch checks against enumValues elements]
    N -- No --> P[isTypeMatch checks pipe-delimited type tokens]
    O --> Q[formatExpectedType renders empty string as double-quoted]
Loading

Reviews (6): Last reviewed commit: "Stack params editor rows on mobile" | Re-trigger Greptile

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
apps/web/src/tests/browser/shared/abstractions/components/schema-editor.component.js (1)

189-208: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Consider consolidating the near-duplicate params-dialog helpers.

editRowParamsWithDialog and editRowEnumParamsWithDialog differ only in which paramsEditor setter is invoked per entry. A single helper taking a setter callback would avoid future drift between the two.

♻️ Proposed consolidation
-  async editRowParamsWithDialog(index, valuesByName) {
-    await this.ensureSchemaMode();
-    await this.dismissOpenHelpTooltips();
-    await this.row(index).locator('[data-action="edit-params"]').click();
-    for (const [name, value] of Object.entries(valuesByName || {})) {
-      await this.paramsEditor.setValue(name, value);
-    }
-    await this.paramsEditor.apply();
-  }
-
-  async editRowEnumParamsWithDialog(index, valuesByName) {
-    await this.ensureSchemaMode();
-    await this.dismissOpenHelpTooltips();
-    await this.row(index).locator('[data-action="edit-params"]').click();
-    for (const [name, value] of Object.entries(valuesByName || {})) {
-      await this.paramsEditor.selectEnumValue(name, value);
-    }
-    await this.paramsEditor.apply();
-  }
+  async editRowParamsWithDialog(index, valuesByName, { setter = 'setValue' } = {}) {
+    await this.ensureSchemaMode();
+    await this.dismissOpenHelpTooltips();
+    await this.row(index).locator('[data-action="edit-params"]').click();
+    for (const [name, value] of Object.entries(valuesByName || {})) {
+      await this.paramsEditor[setter](name, value);
+    }
+    await this.paramsEditor.apply();
+  }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@apps/web/src/tests/browser/shared/abstractions/components/schema-editor.component.js`
around lines 189 - 208, The two params-dialog helpers are near-duplicates, so
consolidate them into a single shared flow in schema-editor.component.js.
Refactor editRowParamsWithDialog and editRowEnumParamsWithDialog to use one
internal helper that handles ensureSchemaMode, dismissOpenHelpTooltips,
row(...).locator('[data-action="edit-params"]').click(), iteration over
valuesByName, and paramsEditor.apply(), while accepting a setter callback to
choose between paramsEditor.setValue and paramsEditor.selectEnumValue. Keep the
existing public method names as thin wrappers if needed.
packages/core/js/keywords/domain/word/adverb-keyword-definition.js (1)

3-3: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Consider extracting WORD_SELECTION_STRATEGY_TYPE into a shared constant.

This same array is now duplicated verbatim across adverb, conjunction, noun, preposition, sample, and verb keyword definitions (and likely adjective/interjection). A single source of truth would prevent future drift if the allowed strategies ever change.

♻️ Suggested consolidation
+// packages/core/js/keywords/domain/word/word-selection-strategy.js
+export const WORD_SELECTION_STRATEGY_TYPE = ['fail', 'closest', 'shortest', 'longest', 'any-length'];

Then import it in each word/*-keyword-definition.js file instead of redeclaring.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/core/js/keywords/domain/word/adverb-keyword-definition.js` at line
3, Extract the duplicated WORD_SELECTION_STRATEGY_TYPE array into a shared
constant and import it from each word keyword definition instead of redeclaring
it. Update adverbKeywordDefinition and the other word/*-keyword-definition.js
modules that currently define the same array so they all reference the shared
source of truth, keeping the existing symbol name available where needed.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@packages/core-ui/js/gui_components/shared/test-data/ui/params-editor-modal.js`:
- Around line 412-414: The boolean option handling in readRenderedEntryState and
hasEntryValue is treating the always-checked Unset radio as a filled value,
which makes optional booleans look set and affects lastFilledIndex/syncPreview.
Update the boolean branch so isSet is derived from the selected radio’s
non-empty value rather than Boolean(checkedBooleanOption), and keep
hasEntryValue aligned with that behavior. Add a regression test for an optional
boolean left Unset to verify it produces no param/empty preview and does not
shift later required entries.

---

Nitpick comments:
In
`@apps/web/src/tests/browser/shared/abstractions/components/schema-editor.component.js`:
- Around line 189-208: The two params-dialog helpers are near-duplicates, so
consolidate them into a single shared flow in schema-editor.component.js.
Refactor editRowParamsWithDialog and editRowEnumParamsWithDialog to use one
internal helper that handles ensureSchemaMode, dismissOpenHelpTooltips,
row(...).locator('[data-action="edit-params"]').click(), iteration over
valuesByName, and paramsEditor.apply(), while accepting a setter callback to
choose between paramsEditor.setValue and paramsEditor.selectEnumValue. Keep the
existing public method names as thin wrappers if needed.

In `@packages/core/js/keywords/domain/word/adverb-keyword-definition.js`:
- Line 3: Extract the duplicated WORD_SELECTION_STRATEGY_TYPE array into a
shared constant and import it from each word keyword definition instead of
redeclaring it. Update adverbKeywordDefinition and the other
word/*-keyword-definition.js modules that currently define the same array so
they all reference the shared source of truth, keeping the existing symbol name
available where needed.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 677345a8-da2c-4b80-9bfe-b3eebd9f0be0

📥 Commits

Reviewing files that changed from the base of the PR and between c054f69 and 1d9568f.

📒 Files selected for processing (50)
  • apps/web/src/stories/shared-schema-definition.stories.js
  • apps/web/src/tests/browser/generator/functional/schema-edit.spec.js
  • apps/web/src/tests/browser/shared/abstractions/components/params-editor-dialog.component.js
  • apps/web/src/tests/browser/shared/abstractions/components/schema-editor.component.js
  • packages/core-ui/js/gui_components/shared/test-data/help/help-model-builder.js
  • packages/core-ui/js/gui_components/shared/test-data/ui/params-editor-modal.css
  • packages/core-ui/js/gui_components/shared/test-data/ui/params-editor-modal.js
  • packages/core-ui/src/tests/shared/help-model-builder.test.js
  • packages/core-ui/src/tests/shared/shared-schema-editor-controller.test.js
  • packages/core-ui/src/tests/utils/faker-command-help-metadata.test.js
  • packages/core-ui/src/tests/utils/params-editor-modal.test.js
  • packages/core/js/domain/domain-keywords.js
  • packages/core/js/faker/faker-helper-keyword-definitions.js
  • packages/core/js/keywords/domain/airline/seat-keyword-definition.js
  • packages/core/js/keywords/domain/autoincrement/timestamp-keyword-definition.js
  • packages/core/js/keywords/domain/color/cmyk-keyword-definition.js
  • packages/core/js/keywords/domain/color/color-by-csscolor-space-keyword-definition.js
  • packages/core/js/keywords/domain/color/hsl-keyword-definition.js
  • packages/core/js/keywords/domain/color/hwb-keyword-definition.js
  • packages/core/js/keywords/domain/color/lab-keyword-definition.js
  • packages/core/js/keywords/domain/color/lch-keyword-definition.js
  • packages/core/js/keywords/domain/color/rgb-keyword-definition.js
  • packages/core/js/keywords/domain/commerce/isbn-keyword-definition.js
  • packages/core/js/keywords/domain/date/birthdate-keyword-definition.js
  • packages/core/js/keywords/domain/finance/bitcoin-address-keyword-definition.js
  • packages/core/js/keywords/domain/internet/ipv4-keyword-definition.js
  • packages/core/js/keywords/domain/internet/mac-keyword-definition.js
  • packages/core/js/keywords/domain/internet/url-keyword-definition.js
  • packages/core/js/keywords/domain/location/country-code-keyword-definition.js
  • packages/core/js/keywords/domain/lorem/word-keyword-definition.js
  • packages/core/js/keywords/domain/person/first-name-keyword-definition.js
  • packages/core/js/keywords/domain/person/last-name-keyword-definition.js
  • packages/core/js/keywords/domain/person/middle-name-keyword-definition.js
  • packages/core/js/keywords/domain/person/prefix-keyword-definition.js
  • packages/core/js/keywords/domain/phone/number-keyword-definition.js
  • packages/core/js/keywords/domain/string/alpha-keyword-definition.js
  • packages/core/js/keywords/domain/string/alphanumeric-keyword-definition.js
  • packages/core/js/keywords/domain/string/hexadecimal-keyword-definition.js
  • packages/core/js/keywords/domain/string/uuid-keyword-definition.js
  • packages/core/js/keywords/domain/word/adjective-keyword-definition.js
  • packages/core/js/keywords/domain/word/adverb-keyword-definition.js
  • packages/core/js/keywords/domain/word/conjunction-keyword-definition.js
  • packages/core/js/keywords/domain/word/interjection-keyword-definition.js
  • packages/core/js/keywords/domain/word/noun-keyword-definition.js
  • packages/core/js/keywords/domain/word/preposition-keyword-definition.js
  • packages/core/js/keywords/domain/word/sample-keyword-definition.js
  • packages/core/js/keywords/domain/word/verb-keyword-definition.js
  • packages/core/src/tests/data_generation/keywords/domain/autoincrement/timestamp-exec.test.js
  • packages/core/src/tests/data_generation/unit/domain/domain-keyword-params-usage.test.js
  • packages/core/src/tests/data_generation/unit/domain/domainKeywords.test.js

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
packages/core/js/data_generation/utils/enumParser.js (1)

106-118: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Duplicated "unquoted empty field" check across three call sites.

The predicate field.value.length === 0 && !field.quoted (or its negation via .every) is reimplemented independently in isImplicitCsvEnumRuleSpec (Line 114), the implicit-CSV branch of parseEnumRuleSpec (Line 184), and parseCsvEnumValues (Line 418). Extracting a shared helper (e.g. hasUnquotedEmptyField(fields)) would keep these three call sites in sync as the empty-value rules evolve.

♻️ Suggested consolidation
+  static hasUnquotedEmptyField(fields) {
+    return fields.some((field) => field.value.length === 0 && !field.quoted);
+  }
+
   static isImplicitCsvEnumRuleSpec(ruleSpec) {
     ...
     try {
       const fields = this.parseCsvLiteralFields(spec);
-      return fields.length >= 2 && fields.every((field) => field.value.length > 0 || field.quoted);
+      return fields.length >= 2 && !this.hasUnquotedEmptyField(fields);
     } catch {
       return false;
     }
   }

Also applies to: 180-192, 398-422

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/core/js/data_generation/utils/enumParser.js` around lines 106 - 118,
The empty unquoted CSV field check is duplicated across
isImplicitCsvEnumRuleSpec, the implicit-CSV branch in parseEnumRuleSpec, and
parseCsvEnumValues. Extract a shared helper for this rule (for example, a
predicate over the parsed fields) and update all three call sites to use it so
the empty-value behavior stays consistent in EnumParser.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@packages/core/js/data_generation/utils/enumParser.js`:
- Around line 106-118: The empty unquoted CSV field check is duplicated across
isImplicitCsvEnumRuleSpec, the implicit-CSV branch in parseEnumRuleSpec, and
parseCsvEnumValues. Extract a shared helper for this rule (for example, a
predicate over the parsed fields) and update all three call sites to use it so
the empty-value behavior stays consistent in EnumParser.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 935bfd21-88a7-41b9-b055-80dc74475207

📥 Commits

Reviewing files that changed from the base of the PR and between 1c64059 and 4601c14.

📒 Files selected for processing (14)
  • apps/web/src/tests/browser/generator/functional/schema-edit.spec.js
  • packages/core-ui/js/gui_components/shared/schema-row-rule-mapper.js
  • packages/core-ui/src/tests/generator/schema-row-rule-mapper.test.js
  • packages/core-ui/src/tests/shared/shared-schema-definition-view.test.js
  • packages/core/js/data_generation/enum/enumTestDataRuleValidator.js
  • packages/core/js/data_generation/utils/enumParser.js
  • packages/core/js/keywords/domain/datatype/datatype-enum.js
  • packages/core/js/keywords/domain/datatype/enum-keyword-definition.js
  • packages/core/src/tests/core-api/generateFromTextSpec.test.js
  • packages/core/src/tests/data_generation/enum-compiler-integration.test.js
  • packages/core/src/tests/data_generation/enum-surface-parity.test.js
  • packages/core/src/tests/data_generation/keywords/domain/datatype/enum-keyword-definition.test.js
  • packages/core/src/tests/data_generation/unit/enum/enumParser.test.js
  • packages/core/src/tests/data_generation/unit/enum/enumTestDataRuleValidator.test.js
💤 Files with no reviewable changes (1)
  • packages/core/js/data_generation/enum/enumTestDataRuleValidator.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants